#include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
  int maximumLengthSubstring(string s)
  {
    int res = 0, tmp = 0;
    unordered_map<char, int> cnt;
    int p = 0;
    for (int i = 0; i < s.size(); i++)
    {
      cnt[s[i]] += 1;
      while (cnt[s[i]] > 2)
      {
        cnt[s[p++]] -= 1;
      }
      res = max(res, i - p + 1);
    }
    return res;
  }
};
int main()
{
  Solution s;

  return 0;
}
